package com.yvon.service.demo.design.proxy;

import java.lang.reflect.Proxy;

/**
 * @author Yvon
 * @since 2022/12/19
 */
public class ProxyTest {

    public static void main(String[] args) {
        Car bmwCar = new BMWCar();
        Car car = (Car) Proxy.newProxyInstance(bmwCar.getClass().getClassLoader(), BMWCar.class.getInterfaces(), new CarInvocationHandler(bmwCar));
        car.run();
    }
}
